import { reactive, onMounted, onBeforeUnmount } from 'vue'
export default ()=> {
  let point = reactive({
    x: 0,
    y: 0
  })

  const usePoint = (event) => {
    point.x = event.x
    point.y = event.y
  }

  onMounted(() => {
    window.addEventListener('click', usePoint)
  })
  onBeforeUnmount(() => {
    window.removeEventListener('click', usePoint)
  })

  return point
}